<article class="media panel panel-default" data-activityid="<%= activity.guid %>">
  <section class="media-object">
    <%= link_to(image_tag(activity.actor.decorate.avatar_url), activity.actor) %>
  </section>

  <section class="media-body">
    <header>
      <div class="btn-group pull-right">
        <a href="#" data-toggle="dropdown" class="btn btn-xs btn-transparent dropdown-toggle">
          <span class="fa fa-angle-down fa-lg"></span>
        </a>
        <ul class="dropdown-menu">
          <li><%= link_to("Edit", edit_note_path(activity.model.object)) if current_user?(activity.actor) %></li>
          <li><%= link_to("Delete", activity.model.object, method: :delete, remote: true) if current_user?(activity.actor) %></li>
        </ul>
      </div>

      <h1>
        <%= link_to(activity.actor.display_name, person_activities_path(person_id: activity.actor.id)) %>
        <small class="text-muted"> -
          <%= link_to(activity.model.object.decorate.created_at_time_ago, activity_activities_path(activity_id: activity.id), class: "text-muted") %> -
          <!-- FIXME: Displays duplicates -->
          <% activity.audiences.distinct.each do |audience| %>
            <span title="<%= t(".tooltip.sharing") %>", data-behavior="tooltip-on-hover" }><%= link_to(audience.privacy.text, audience_activity_path(activity), class: "text-muted", data: { behavior: "tooltip-on-click" }) %></span>
          <% end %>
        </small>
      </h1>
    </header>

    <%= render "socializer/activities/activity_content", activity: activity %>

    <footer class="media-body-footer">
      <div class="btn-group">
        <%# Like / Unlike button %>
        <%= activity.activity_object.decorate.link_to_like_or_unlike %>

        <%# Comment button %>
        <% if activity.activitable_object.note? || activity.activitable_object.activity? %>
          <%= link_to(content_tag(:span, nil, class: "fa fa-fw fa-comments-o"), comment_activity_path(activity), class: "btn btn-default", title: "Comment", data: { behavior: "tooltip-on-hover" }) %>
        <% end %>

        <%# Share button %>
        <%# TODO: Need a Share count %>
        <% if activity.activitable_object.note?  %>
          <%= link_to(content_tag(:span, nil, class: "fa fa-fw fa-share"), new_share_activity_path(activity.activity_object), class: "btn btn-default", title: "Share", data: { behavior: "tooltip-on-hover" }) %>
        <% end %>
      </div>
    </footer>

    <% if activity.comments? %>
    <section class="media-comments">
      <% activity.comments.decorate.each do |comment| %>
        <%= render "socializer/comments/comment", comment: comment %>
      <% end %>
    </section>
    <% end %>
  </section>
</article>

<!-- <li data-activityid="<%= activity.guid %>">

  <%# Activity top (for notes and activities) %>
  <%# if activity.activitable_object.note? || activity.activitable_object.activity? %>

    <%#= render "socializer/activities/activity_top", activity: activity %>

  <%# end %>

  <%#= render "socializer/activities/activity_content", activity: activity %>

  <%#= render "socializer/activities/activity_bottom", activity: activity %>

  <%# Render comments %>
  <ul>
    <%# activity.comments.decorate.each do |subactivity| %>

      <li><%#= render subactivity %></li>

    <%# end %>
  </ul>

</li> -->
